home *** CD-ROM | disk | FTP | other *** search
-
- function bandwidthtest_options_init(){
- try{
-
- var oPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("");
-
- // Prefill
- if(oPrefs.prefHasUserValue("bandwidthtest.files.1"))
- document.getElementById("file_1").value = oPrefs.getCharPref("bandwidthtest.files.1");
- if(oPrefs.prefHasUserValue("bandwidthtest.files.2"))
- document.getElementById("file_2").value = oPrefs.getCharPref("bandwidthtest.files.2");
- if(oPrefs.prefHasUserValue("bandwidthtest.files.3"))
- document.getElementById("file_3").value = oPrefs.getCharPref("bandwidthtest.files.3");
- if(oPrefs.prefHasUserValue("bandwidthtest.files.4"))
- document.getElementById("file_4").value = oPrefs.getCharPref("bandwidthtest.files.4");
- if(oPrefs.prefHasUserValue("bandwidthtest.files.5"))
- document.getElementById("file_5").value = oPrefs.getCharPref("bandwidthtest.files.5");
-
- }catch(e){ alert("Could not load preferences.\n"+ e); }
- }
-
- function bandwidthtest_options_save(){
- try{
-
- var oPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).getBranch("");
-
- // Save
- oPrefs.setCharPref("bandwidthtest.files.1", document.getElementById("file_1").value);
- oPrefs.setCharPref("bandwidthtest.files.2", document.getElementById("file_2").value);
- oPrefs.setCharPref("bandwidthtest.files.3", document.getElementById("file_3").value);
- oPrefs.setCharPref("bandwidthtest.files.4", document.getElementById("file_4").value);
- oPrefs.setCharPref("bandwidthtest.files.5", document.getElementById("file_5").value);
-
- }catch(e){ alert("Could not save preferences.\n"+ e); }
-
- return true;
- }